using System;
using System.Collections.Generic;


namespace LiveCS.Models
{
	[Serializable]
	public class Fightingmember: IEquatable<Fightingmember>
	{

		#region Private Members

		private string _cardid; 
		private IList<Fightingmember> _FightingmemberList; 
		private IList<Fightingmember> _FightingmemberList; 
		private int _memberstate; 
		private DateTime _gamestarttime; 
		private DateTime _deadtime; 
		private DateTime _cheattime; 
		private string _groupid; 
		private string _fightid; 
		private DateTime _gameovertime; 
		private string _classid; 		
		#endregion

		#region Constructor

		public Fightingmember()
		{
			_cardid = String.Empty; 
			_FightingmemberList = new List<Fightingmember>(); 
			_FightingmemberList = new List<Fightingmember>(); 
			_memberstate = 0; 
			_gamestarttime = DateTime.MinValue; 
			_deadtime = DateTime.MinValue; 
			_cheattime = DateTime.MinValue; 
			_groupid = String.Empty; 
			_fightid = String.Empty; 
			_gameovertime = DateTime.MinValue; 
			_classid = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Fightingmember(
			string cardid)
			: this()
		{
			_cardid = cardid;
			_memberstate = 0;
			_gamestarttime = DateTime.MinValue;
			_deadtime = DateTime.MinValue;
			_cheattime = DateTime.MinValue;
			_groupid = String.Empty;
			_fightid = String.Empty;
			_gameovertime = DateTime.MinValue;
			_classid = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string Cardid
		{
			get
			{ 
				return _cardid;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Cardid", value, "null");
				
				if(  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for Cardid", value, value.ToString());
				
				_cardid = value;
			}
		}
			
		public virtual IList<Fightingmember> FightingmemberList
		{
			get
			{
				return _FightingmemberList;
			}
			set
			{
				_FightingmemberList = value;
			}
		}

		public virtual IList<Fightingmember> FightingmemberList
		{
			get
			{
				return _FightingmemberList;
			}
			set
			{
				_FightingmemberList = value;
			}
		}

		public virtual int MemberState
		{
			get
			{ 
				return _memberstate;
			}
			set
			{
				_memberstate = value;
			}

		}
			
		public virtual DateTime GameStartTime
		{
			get
			{ 
				return _gamestarttime;
			}
			set
			{
				_gamestarttime = value;
			}

		}
			
		public virtual DateTime DeadTime
		{
			get
			{ 
				return _deadtime;
			}
			set
			{
				_deadtime = value;
			}

		}
			
		public virtual DateTime CheatTime
		{
			get
			{ 
				return _cheattime;
			}
			set
			{
				_cheattime = value;
			}

		}
			
		public virtual string Groupid
		{
			get
			{ 
				return _groupid;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Groupid", value, value.ToString());
				
				_groupid = value;
			}
		}
			
		public virtual string Fightid
		{
			get
			{ 
				return _fightid;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Fightid", value, value.ToString());
				
				_fightid = value;
			}
		}
			
		public virtual DateTime GameOverTime
		{
			get
			{ 
				return _gameovertime;
			}
			set
			{
				_gameovertime = value;
			}

		}
			
		public virtual string Classid
		{
			get
			{ 
				return _classid;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Classid", value, value.ToString());
				
				_classid = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		public virtual void AddFightingmember(Fightingmember obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_FightingmemberList.Add(obj);
		}
		

		public virtual void AddFightingmember(Fightingmember obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_FightingmemberList.Add(obj);
		}
		

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Fightingmember castObj = (Fightingmember)obj; 
			return ( castObj != null ) &&
				( this._cardid == castObj.Cardid );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _cardid.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Fightingmember other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._cardid == other.Cardid );
				   
		}

		#endregion
		
	}
}
